// Log for retain count regardless if we opened the connection here
this.addRetainDomain( itemInfo.assetDomain );
},
requestFinished : function()
{
this.activeRequests--;
this.popRequest();
},
// threading
runOnThread : function( func )
{
func.defineMainThreadCallbackPrototype();
let thread = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0);
thread.dispatch( func , thread.DISPATCH_NORMAL);
this.threads.push(thread);
},
// process
markupCallback : function(downloader)
{
// this.APP.d('markupCallback ' + this.url);
this.requestFinished();
if (!downloader.success) return this.finish(false);
this.imagesProcessed = false;
this.stylesheetsProcessed = false;
this.runOnThread( new this.processor('processMarkup', {markup:downloader.data,url:this.url}, this) );
},
markupProcessed : function(markup)
{
//this.APP.d('markupProcessed ' + this.url);
this.imagesProcessed = true;
this.stylesheetsProcessed = true;
this.markup = markup;
this.checkIfFinished();
},
// asset call
// Processor Thread
// Handles markup and spawns asset downloads
processor : function(action, vars, delegate)
{
// dump("\nprocessor");
this.action = action;
this.delegate = delegate; // is this safe as long as the thread doesn't touch it, just passes it? - otherwise send an id that corresponds to the webDownloader and save it to the OFFLINE object
for(let i in vars)
{
this[i] = vars[i];
}
// Because only one specific item of content is ever processed at a time, we dropped the need to do contentId lookups with this
//this.dupeCheckAbsolute = {}; // absolute is handled in the scope of RILwebDownloader
this.dupeCheckLiteral = {}; // literals are handled in the scope per file (per processor thread)